home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / CDROM / SCDPlayer / Sources / SCDP.h < prev    next >
C/C++ Source or Header  |  1996-09-25  |  7KB  |  287 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <stdlib.h>
  6. #include <dos.h>
  7. #include <dos/dos.h>
  8. #include <graphics/gfxmacros.h>
  9. #include <exec/types.h>
  10. #include <exec/io.h>
  11. #include <exec/execbase.h>
  12. #include <exec/nodes.h>
  13. #include <exec/memory.h>
  14. #include <exec/libraries.h>
  15. #include <workbench/workbench.h>
  16. #include <workbench/startup.h>
  17. #include <devices/trackdisk.h>
  18. #include <devices/scsidisk.h>
  19. #include <devices/timer.h>
  20. #include <devices/inputevent.h>
  21. #include <libraries/dos.h>
  22. #include <libraries/mui.h>
  23. #include <libraries/diskfont.h>
  24. #include <clib/diskfont_protos.h>
  25. #include <clib/alib_protos.h>
  26. #include <clib/asl_protos.h>
  27. #include <clib/muimaster_protos.h>
  28. #include <clib/exec_protos.h>
  29. #include <clib/dos_protos.h>
  30. #include <clib/utility_protos.h>
  31. #include <clib/gadtools_protos.h>
  32. #include <clib/graphics_protos.h>
  33. #include <clib/icon_protos.h>
  34. #include <clib/commodities_protos.h>
  35. #include <clib/wb_protos.h>
  36. #include <clib/intuition_protos.h>
  37. #include <clib/locale_protos.h>
  38. #include <intuition/intuition.h>
  39. #include <intuition/gadgetclass.h>
  40. #include <graphics/displayinfo.h>
  41. #include <pragmas/diskfont_pragmas.h>
  42. #include <pragmas/exec_sysbase_pragmas.h>
  43. #include <pragmas/dos_pragmas.h>
  44. #include <pragmas/icon_pragmas.h>
  45. #include <pragmas/graphics_pragmas.h>
  46. #include <pragmas/intuition_pragmas.h>
  47. #include <pragmas/gadtools_pragmas.h>
  48. #include <pragmas/utility_pragmas.h>
  49. #include <pragmas/asl_pragmas.h>
  50. #include <pragmas/muimaster_pragmas.h>
  51. #include <pragmas/locale_pragmas.h>
  52.  
  53. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase,*DiskfontBase;
  54. struct Library *MUIMasterBase, *LocaleBase;
  55. struct Catalog *catalog;
  56.  
  57. #define VERSION "1.7"
  58.  
  59. #include "scdplocale.h"
  60.  
  61. #define STACKSIZE 16384
  62.  
  63. #define REG(x) register __ ## x
  64. #define ASM    __asm
  65. #define SAVEDS __saveds
  66.  
  67. /* For the fonts */
  68. struct TextFont *normalfont=NULL;
  69. struct TextFont *tinyfont=NULL;
  70. struct TextFont *fixedfont=NULL;
  71. struct TextFont *listfont=NULL;
  72. struct TextFont *titlefont=NULL;
  73. BOOL customfonts=FALSE;
  74. char *normalname="topaz/8";
  75. char *tinyname="topaz/8";
  76. char *fixedname="topaz/8";
  77. char *listname="topaz/8";
  78. char *titlename="topaz/8";
  79. /* For disks path */
  80. char diskspath[513]="PROGDIR:disks";
  81.  
  82. struct MUI_CustomClass *CL_ProgramList=NULL;
  83. struct MUI_CustomClass *CL_KeyGroup=NULL;
  84.  
  85. /*************************/
  86. /* Init & Fail Functions */
  87. /*************************/
  88.  
  89. static VOID fail(APTR app,char *str)
  90. {
  91.         if (app)
  92.                 MUI_DisposeObject(app);
  93.  
  94. #ifndef _DCC
  95.         if (MUIMasterBase)
  96.                 CloseLibrary(MUIMasterBase);
  97. #endif
  98.         if (LocaleBase)
  99.         {
  100.             CloseLibrary(LocaleBase);
  101.             if(catalog)
  102.                 CloseCatalog(catalog);
  103.         }
  104.  
  105.         if(normalfont)
  106.             CloseFont(normalfont);
  107.         if(tinyfont)
  108.             CloseFont(tinyfont);
  109.         if(fixedfont)
  110.             CloseFont(fixedfont);
  111.         if(listfont)
  112.             CloseFont(listfont);
  113.         if(titlefont)
  114.             CloseFont(titlefont);
  115.  
  116.         if(CL_ProgramList)
  117.             MUI_DeleteCustomClass(CL_ProgramList);
  118.  
  119.         if(CL_KeyGroup)
  120.             MUI_DeleteCustomClass(CL_KeyGroup);
  121.  
  122.         if (str)
  123.         {
  124.                 puts(str);
  125.                 exit(20);
  126.         }
  127.         exit(0);
  128. }
  129.  
  130.  
  131. #ifdef _DCC
  132.  
  133. int brkfunc(void) { return(0); }
  134.  
  135. int wbmain(struct WBStartup *wb_startup)
  136. {
  137.         extern int main(int argc, char *argv[]);
  138.         return (main(0, (char **)wb_startup));
  139. }
  140.  
  141. #endif
  142.  
  143.  
  144. #ifdef __SASC
  145. int CXBRK(void) { return(0); }
  146. int _CXBRK(void) { return(0); }
  147. void chkabort(void) {}
  148. #endif
  149.  
  150.  
  151. static VOID init(VOID)
  152. {
  153. #ifdef _DCC
  154.         onbreak(brkfunc);
  155. #endif
  156.  
  157. #ifndef _DCC
  158.         if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  159.                 fail(NULL,glstr(MSG_FailMUI));
  160. #endif
  161.         if(LocaleBase = OpenLibrary("locale.library",38))
  162.         {
  163.             catalog=OpenCatalog(NULL,"scdp.catalog",NULL);
  164.         }
  165. }
  166.  
  167.  
  168. #ifndef MAKE_ID
  169. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  170. #endif
  171.  
  172.  
  173. #define BYTES_PER_LINE  16
  174. #define SENSE_LEN 252
  175. #define MAX_DATA_LEN 252
  176. #define MAX_TOC_LEN 804         /* max TOC size = 100 TOC track descriptors */
  177. #define PAD 0
  178. #define LINE_BUF        (128)
  179. #define NUM_OF_CDDAFRAMES 75    /* 75 frames per second audio */
  180. #define CDDALEN 2448            /* 1 frame has max. 2448 bytes (subcode 2) */
  181.  
  182. #define OFFS_KEY 2
  183. #define OFFS_CODE 12
  184.  
  185. typedef struct MsgPort MSGPORT;
  186. typedef struct IOStdReq IOSTDREQ;
  187. typedef struct List LIST;
  188. typedef struct Node NODE;
  189. typedef struct SCSICmd SCSICMD;
  190.  
  191. typedef struct
  192.  {
  193.    BYTE   code;
  194.    UBYTE  *ptr;
  195.  } IDTOSTRING;
  196.  
  197. typedef struct
  198.  {
  199.    UBYTE  opcode;
  200.    UBYTE  b1;
  201.    UBYTE  b2;
  202.    UBYTE  b3;
  203.    UBYTE  b4;
  204.    UBYTE  control;
  205.  } SCSICMD6;
  206.  
  207. typedef struct
  208.  {
  209.    UBYTE  opcode;
  210.    UBYTE  b1;
  211.    UBYTE  b2;
  212.    UBYTE  b3;
  213.    UBYTE  b4;
  214.    UBYTE  b5;
  215.    UBYTE  b6;
  216.    UBYTE  b7;
  217.    UBYTE  b8;
  218.    UBYTE  control;
  219.  } SCSICMD10;
  220.  
  221. typedef struct
  222.  {
  223.    UBYTE  opcode;
  224.    UBYTE  b1;
  225.    UBYTE  b2;
  226.    UBYTE  b3;
  227.    UBYTE  b4;
  228.    UBYTE  b5;
  229.    UBYTE  b6;
  230.    UBYTE  b7;
  231.    UBYTE  b8;
  232.    UBYTE  b9;
  233.    UBYTE  b10;
  234.    UBYTE  control;
  235.  } SCSICMD12;
  236.  
  237. #define SCSI_CMD_TUR    0x00
  238. #define SCSI_CMD_RZU    0x01
  239. #define SCSI_CMD_RQS    0x03
  240. #define SCSI_CMD_FMU    0x04
  241. #define SCSI_CMD_RAB    0x07
  242. #define SCSI_CMD_RD     0x08
  243. #define SCSI_CMD_WR     0x0A
  244. #define SCSI_CMD_SK     0x0B
  245. #define SCSI_CMD_INQ    0x12
  246. #define SCSI_CMD_MSL    0x15
  247. #define SCSI_CMD_RU     0x16
  248. #define SCSI_CMD_RLU    0x17
  249. #define SCSI_CMD_MSE    0x1A
  250. #define SCSI_CMD_SSU    0x1B
  251. #define SCSI_CMD_RDI    0x1C
  252. #define SCSI_CMD_SDI    0x1D
  253. #define SCSI_CMD_PAMR   0x1E
  254. #define SCSI_CMD_RCP    0x25
  255. #define SCSI_CMD_RXT    0x28
  256. #define SCSI_CMD_WXT    0x2A
  257. #define SCSI_CMD_SKX    0x2B
  258. #define SCSI_CMD_WVF    0x2E
  259. #define SCSI_CMD_VF     0x2F
  260. #define SCSI_CMD_RDD    0x37
  261. #define SCSI_CMD_WDB    0x3B
  262. #define SCSI_CMD_RDB    0x3C
  263.  
  264. #define SCSI_CMD_COPY           0x18
  265. #define SCSI_CMD_COMPARE        0x39
  266. #define SCSI_CMD_COPYANDVERIFY  0x3A
  267. #define SCSI_CMD_CHGEDEF        0x40
  268. #define SCSI_CMD_READSUBCHANNEL 0x42
  269. #define SCSI_CMD_READTOC        0x43
  270. #define SCSI_CMD_READHEADER     0x44
  271. #define SCSI_CMD_PLAYAUDIO12    0xA5
  272. #define SCSI_CMD_PLAYAUDIOTRACKINDEX    0x48
  273. #define SCSI_CMD_PAUSERESUME    0x4B
  274.  
  275. #define CheckMarkH(selected,help)\
  276.         ImageObject,\
  277.                 ImageButtonFrame,\
  278.                 MUIA_InputMode        , MUIV_InputMode_Toggle,\
  279.                 MUIA_Image_Spec       , MUII_CheckMark,\
  280.                 MUIA_Image_FreeVert   , TRUE,\
  281.                 MUIA_Selected         , selected,\
  282.                 MUIA_Background       , MUII_ButtonBack,\
  283.                 MUIA_ShowSelState     , FALSE,\
  284.                 MUIA_ShortHelp        , help,\
  285.                 End
  286.  
  287.